package com.squid.monitor.service.redis;

import com.squid.base.utils.RedissonRedisUtils;
import com.squid.monitor.model.request.InsertRedisListKeyRequest;
import com.squid.monitor.model.request.InsertRedisStringKeyRequest;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

/**
 * Redis服务
 *
 * @author jinhang1
 * @date 2024/07/24
 */
@Service
public class RedisServiceImpl implements RedisService {
    @Resource
    RedissonRedisUtils redissonRedisUtils;

    @Override
    public Object getAllKey() {
        Object resp = redissonRedisUtils.getAllKey();
        return resp;
    }

    @Override
    public void setExpiredStringKey(InsertRedisStringKeyRequest req) {
        redissonRedisUtils.setExpiredStringKey(req.getKey(), req.getValue(), req.getExpireTime());
    }

    @Override
    public Object getStringKey(String key) {
        Object resp = redissonRedisUtils.getStringKey(key);
        return resp;
    }

    @Override
    public void setExpiredListKey(InsertRedisListKeyRequest req) {
        redissonRedisUtils.setExpiredListKey(req.getKey(), req.getValue(), req.getExpireTime());
    }

    @Override
    public Object getListKey(String key) {
        Object resp = redissonRedisUtils.getListKey(key);
        return resp;
    }
}
